from openai import OpenAI

from config.model_config import get_base_open_ai, xin_qwen_model

client = get_base_open_ai()
response = client.chat.completions.create(
    model=xin_qwen_model,
    messages=[
        {
            "content": "写一封给女生的情信?",
            "role": "user",
        }
    ],
    max_tokens=500,
    temperature=0.7,
    stream=True
)
print(response)
for chunk in response:
    print(chunk.choices[0].delta.content, end="", flush=True)

# for chunk in response:
#     print(chunk.choices[0].delta.content, end="", flush=True)